<?php // Create XML output
header("content-type:text/xml;charset=utf-8");
preg_match('|^(.*?/)(grand-media)/|i', str_replace('\\', '/', __FILE__), $_m);
require_once( $_m[1] . 'grand-media/config.php');
$gmID = intval( grandCore::_get('vID','') );
if($gmID && $gmedia = get_post($gmID) ){
	$gmThumb = get_post_meta($gmedia->ID, '_gmedia_thumb', true);
	$gmURL = wp_get_attachment_url($gmedia->ID);
	$xml = '<item id="'.$gmedia->ID.'">
	<properties>
		<property0>0xffffff</property0>
		<property1>0x3283A7</property1>
		<property2>0x000000</property2>
	</properties>
	<content>
	  	<preview>'.$gmURL.'</preview>
  		<title><![CDATA['.$gmedia->post_title.']]></title>
  		<description><![CDATA['.$gmedia->post_content.']]></description>
  		<thumbnail>'.$gmThumb.'</thumbnail>
	</content>
</item>';
} else {
	$xml = '<item id="0">
	<properties>
		<property0>0xffffff</property0>
		<property1>0x3283A7</property1>
		<property2>0x000000</property2>
	</properties>
	<content>
	  	<preview></preview>
  		<title><![CDATA['.__('Error! No media file...').']]></title>
  		<description><![CDATA[]]></description>
  		<thumbnail></thumbnail>
	</content>
</item>';
}
print $xml;
?>